﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestDrivenDevelopment.Models;

namespace TestDrivenDevelopment.Controllers
{
    public class HomeController : Controller
    {
        private readonly ITaskRepository _repository;

        public HomeController(ITaskRepository repository)
        {
            _repository = repository;
        }

        public HomeController()
        {
            _repository = _repository ?? new TaskRepository();
        }

        //
        // GET: /Home/

        public ViewResult Index()
        {
            return View(_repository.GetTasks());
        }

    }
}
